package com.rl.dao;

import com.rl.domain.*;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface UserDao {
    User selectUserByUid(@Param("uid") int uid);
    User selectUserByNamePwd(@Param("name") String name, @Param("pwd") String pwd);
    int selectUserIdByName(String uname);
    User selectUserByName(@Param("uname") String name);
    void insertUser(User user);
    void updataUserByName(@Param("uname")String uname,@Param("pwd") String pwd,@Param("name") String name);

    List<Book> selectBook();
    Book selectBookById(int bid);
    int selectBookIdByName(String bname);
    List<Book> selectBooksByName(@Param("name")String name);
    void  updateBookNum(@Param("bid")int bid,@Param("num")int num);

    void insertShoppingCart(ShoppingCart shoppingCart);

    List<Book> selectShoppingCarByUserName(String uname);
    Book selectShoppingCartBookByBidUname(@Param("uname")String uname,@Param("bid")int bid);

    void updataShoppingcartBookByBidUid(@Param("bnum")int bnum,@Param("bid")int bid,@Param("uid")int uid);

    void deleteShoppingcartBookByBidUid(@Param("bid")int bid,@Param("uid")int uid);

    void insertShoppingHistory(ShoppingHistory shoppingHistory);
    List<Book> selectShoppingHistoryUserName(@Param("uname")String name);
    void deleteHistoryByUidBid(@Param("bid")int bid,@Param("uid")int uid);

    List<Mail> selectEmailByName(String uname2);
    void insertEmail(Mail mail);

    void insertOrders(Orders orders);
    List<Orders> selectOrdersByUid(@Param("uid")int uid1);
    Orders selectOrdersByOid(@Param("oid")int oid);
    List<Orders> selectFaOrdersByUid(@Param("uid")int uid1);
    List<Orders> selectOrdersByUid1(@Param("uid")int uid1);
    List<Orders> selectByOrdersByUid(@Param("uid")int uid1);

    void updateOrdersByOid(@Param("flag")int flag,@Param("oid")int oid);
    void updateOrdersUid1ByOid(@Param("uid1")int uid1,@Param("oid")int oid);
    void updateOrdersNumByOid(@Param("num")int num,@Param("oid")int oid);
    void updateOrdersFlag2ByOid(@Param("flag2")int flag2,@Param("oid")int oid);
}
